import { EventMouse } from 'cc';
import { Input, input, EventTouch, v2, Vec2, math, log, screen } from 'cc';
import { Observable, Observer, filter } from "rxjs";

export function MouseMove() {
    return new Observable((observer: Observer<EventMouse>) => {
        const onMouseMove = (eventMouse: EventMouse) => {
            observer.next(eventMouse);
        };
        input.on(Input.EventType.MOUSE_MOVE, onMouseMove, this);
        return () => {
            input.off(Input.EventType.MOUSE_MOVE, onMouseMove, this);
        }
    });
}